DEFINITION FOR AMIGALIB MODULE Parallel ;

FROM SYSTEM IMPORT SHORTSET ;
FROM Exec IMPORT IOStdReq , CMD_NONSTD ;

TYPE
  IOPArrayPtr = POINTER TO IOPArray ;
  IOExtParPtr = POINTER TO IOExtPar ;

  IOPArray = RECORD
    PTermArray0 : LONGINT ;
    PTermArray1 : LONGINT ;
  END ;

(**********************************************************************)
(*								      *)
(* CAUTION !!  IF YOU ACCESS the parallel.device, you MUST (!!!!) use *)
(* an IOExtPar-sized structure or you may overlay innocent memory !!  *)
(*								      *)
(**********************************************************************)

  IOExtPar = RECORD
    IOPar	  : IOStdReq  ;
    io_PExtFlags  : LONGINT   ; (* (not used) flag extension area	 *)
    io_Status	  : SHORTCARD ; (* status of parallel port and registers *)
    io_ParFlags   : SHORTSET  ; (* see PARFLAGS bit definitions below    *)
    io_PTermArray : IOPArray  ; (* termination character array		 *)
  END ;

CONST
  PARB_SHARED		=  5  ;	(* ParFlags non-exclusive access bit	*)
  PARF_SHARED		= {5} ;	(*     "     non-exclusive access mask	*)
  PARB_RAD_BOOGIE	=  3  ;	(*     "     (not yet implemented)	*)
  PARF_RAD_BOOGIE	= {3} ;	(*     "     (not yet implemented)	*)
  PARB_EOFMODE		=  1  ;	(*     "     EOF mode enabled bit	*)
  PARF_EOFMODE		= {1} ;	(*     "     EOF mode enabled mask	*)

  IOPARB_QUEUED		=  6  ;	(* IO_FLAGS rqst-queued bit		*)
  IOPARF_QUEUED		= {6} ;	(*     "     rqst-queued mask		*)
  IOPARB_ABORT		=  5  ;	(*     "     rqst-aborted bit		*)
  IOPARF_ABORT		= {5} ;	(*     "     rqst-aborted mask		*)
  IOPARB_ACTIVE		=  4  ;	(*     "     rqst-qued-or-current bit	*)
  IOPARF_ACTIVE		= {4} ;	(*     "     rqst-qued-or-current mask	*)

  IOPTB_RWDIR		=  3  ;	(* IO_STATUS read=0,write=1 bit		   *)
  IOPTF_RWDIR		= {3} ;	(*     "     read=0,write=1 mask	   *)
  IOPTB_PARSEL		=  2  ;	(*     "     printer selected on the A1000 *)
  IOPTF_PARSEL		= {2} ;	(* printer selected&serial "Ring Indicator"*)
				(*  on the A500 & A2000.  Be careful when  *)
				(* making cables			   *)

  IOPTB_PAPEROUT	=  1  ;	(*     "     paper out bit		   *)
  IOPTF_PAPEROUT	= {1} ;	(*     "     paper out mask		   *)
  IOPTB_PARBUSY		=  0  ;	(*     "     printer in busy toggle bit    *)
  IOPTF_PARBUSY		= {0} ;	(*     "     printer in busy toggle mask   *)

  (* Note: previous versions of this include files had bits 0 and 2 swapped *)

  PARALLELNAME	= "parallel.device" ;

  PDCMD_QUERY		= CMD_NONSTD ;
  PDCMD_SETPARAMS	= CMD_NONSTD+1 ;

  ParErr_DevBusy	= 1 ;
  ParErr_BufTooBig	= 2 ;
  ParErr_InvParam	= 3 ;
  ParErr_LineErr	= 4 ;
  ParErr_NotOpen	= 5 ;
  ParErr_PortReset	= 6 ;
  ParErr_InitErr	= 7 ;

END Parallel.
